<template>
	<view>
		<topTitle :name="`注册钱包`" right="" back class="bg_w"/>
		<view class="content pdx-32 pdy-20">
			<view class="box pdy-16 pdx-20">
				<view class="fs14 h-100 flex j-c-b f-a-c border-b">
					<view>身份证号码</view>
					<input class="text-r" v-model="form.certNo" type="text" placeholder="请输入您的身份证号码">
				</view>
				<view class="fs14 h-100 flex j-c-b f-a-c border-b">
					<view>姓名</view>
					<input class="text-r" v-model="form.name" type="text" placeholder="请输入您的姓名">
				</view>
				<view class="fs14 h-100 flex j-c-b f-a-c">
					<view>手机号</view>
					<input class="text-r" v-model="form.mobile" type="number" placeholder="请输入您的手机号">
				</view>
			</view>
			<!-- <block v-else>
				<view class="f14 color-6 mb20">身份证头像面</view>
				<view class="box pdx-20 pdy-30">
					<image class="w-646 h-380" mode="aspectFill" :src="'https://www.xmxhd.net'+identityImgz" @click="uploadFile('identityImgz')" v-if="identityImgz"></image>
					<image class="w-646 h-380" src="/static/img/f.png" v-else @click="uploadFile('identityImgz')"></image>
				</view>
				<view class="f14 color-6 mb20">身份证国徽面</view>
				<view class="box pdx-20 pdy-30">
					<image class="w-646 h-380" mode="aspectFill" :src="'https://www.xmxhd.net'+identityImgf" @click="uploadFile('identityImgf')" v-if="identityImgf"></image>
					<image class="w-646 h-380" src="/static/img/b.png" v-else @click="uploadFile('identityImgf')"></image>
				</view>
			</block> -->
			
			<view class="set bg-theme color-w" @click="save">
				保存并下一步
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				step:1,
				identityImgz:'',
				identityImgf:'',
				form:{
					certNo: '',
					name: '',
					mobile: "",
				},
				requestNo:''
			}
		},
		onLoad() {
			// this.util.req(this.api.apiMemberWallet).then(res=>{
			// 	if(res.status==0){
			// 		this.step = 1
			// 	}else{
			// 		this.step = 2
			// 	}
			// })
		},
		methods: {
			save(){
				
				this.util.req(this.api.apiRegisterWallet,this.form).then(res=>{
					this.requestNo = res
					uni.redirectTo({
						url:'/pages/my/bankAdd'
					})
					// this.step = 2;
				}).catch((res)=>{
					uni.showToast({
						title:res.msg,
						icon:'none'
					})
				})
				// if(this.step==1){
					
				// }else{
				// 	this.util.req(this.api.apiDoSupplyCardPic,{
				// 		requestNo:this.requestNo,
				// 		identityImgz:this.identityImgz,
				// 		identityImgf:this.identityImgf
				// 	}).then(res=>{
				// 		uni.redirectTo({
				// 			url:'/pages/my/bankAdd'
				// 		})
				// 	})
				// }
			},
			// 上传图片
			async uploadFile(key) {
				uni.chooseImage({
					count:1,
					success: (res) => {
						uni.uploadFile({
							url: 'https://www.xmxhd.net/api/merchantInfo/image',
							filePath: res.tempFilePaths[0],
							name: "imgFile",
							formData:{
								type:'IDCard',
								managerId:'ad505b485f084cb396b366e57c10a045',
							},
							success: (res) => {
								let data = JSON.parse(res.data)
								this[key] = data.result
							},
						});
					}
				})
			},
		}
	}
</script>
<style>
	page {
		background: #f5f5f5;
	}
</style>
<style scoped>
	.w-646{
		width: 646rpx;
	}
	.h-380{
		height: 380rpx;
	}
	.h-100{
		height: 100rpx;
	}
	.box {
		background: #fff;
		border-radius: 16rpx;
		border: 2rpx solid #eee;
		margin-bottom: 36rpx;
	}
	.set {
		width: 688rpx;
		height: 92rpx;
		line-height: 92rpx;
		border-radius: 20rpx;
		text-align: center;
		margin: 0 auto;
		font-size: 28rpx;
	}
	.pdy-16{
		padding-top: 16rpx;
		padding-bottom: 16rpx;
	}
	.border-b{
		border-bottom: 1px solid #eeeeee;
	}
	.text-r{
		text-align: right;
	}
</style>
